<template>
  <div class="mine">
    <van-card
  :title=title
  :thumb=user.avatar
>
  <template #footer>
    <van-button size="mini" @click="tochangeuser">点击修改用户信息</van-button>
    <van-button size="mini" @click="toupdatapassword">点击修改密码</van-button>
    <van-button size="mini" @click="toReceipt">我的收获地址</van-button>
    <van-button size="mini" @click="tologin">退出登陆</van-button>
  </template>
</van-card>
   <!-- <button class="shouhuo" @click="toReceipt">我的收获地址</button> -->
    </div>
</template>

<script>
import {removeToken} from "../../util/auth"
import {reqgetuser} from "../../api/user"
export default {
  data() {
    return {
      user:{},
      title:"",
    };
  },
  computed: {},
  watch: {},

  methods: {
    //获取用户信息
     async getuser(){
        const result=await reqgetuser()
        console.log(result);
        this.user=result;
        this.title="昵称："+result.nickName;
      },
      //跳转到修改密码界面
      toupdatapassword(){
          this.$router.push("/changepassword");
      },
      //跳转到修改用户信息界面
      tochangeuser(){
          this.$router.push("/changeuser")
      },
      //跳转到收获地址信息界面
      toReceipt(){
        this.$router.push("/receipt")
      },
      //退出登陆，跳转到登陆页面
      tologin(){
        removeToken();
        this.$router.push("/login")
      }
  },
  created() {this.getuser()},
  mounted() {},
  components: {},
};
</script>
<style scoped>
.img{
  width: 100px;
  height: 100px;
}
.changepassword{
  color: aqua;
}
.shouhuo{
  text-align: center;
}
</style>
